import 'package:flutter/material.dart';

class ButtonsPage extends StatelessWidget {
  const ButtonsPage({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("按钮测试"),
      ),
      floatingActionButton: FloatingActionButton(
        child: Icon(Icons.add, color: Colors.green,),
        onPressed: () {
          print("浮动按钮");
        },
        backgroundColor: Colors.deepOrange,
      ),
      
      floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,

      body: Container(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                RaisedButton(
                  child: Text("普通按钮"),
                  onPressed: () {
                    print("普通按钮");
                  }
                ),
                SizedBox(
                  width: 10.0,
                ),
                RaisedButton(
                  child: Text("有颜色按钮"),
                  color: Colors.blue,
                  textColor: Colors.white,
                  onPressed: () {
                    print("普通按钮");
                  }
                ),
                SizedBox(
                  width: 10.0,
                ),
                RaisedButton(
                  child: Text("按钮的影音"),
                  color: Colors.blue,
                  textColor: Colors.white,
                  elevation: 10,
                  onPressed: () {
                    print("普通按钮");
                  }
                )
              ]
            ),
            
            SizedBox(
              height: 20.0,
            ),

            Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Container(
                  height: 80.0,
                  width: 80.0,
                  child: RaisedButton(
                    child: Text("按钮尺寸"),
                    color: Colors.blue,
                    textColor: Colors.white,
                    onPressed: () {
                      print("普通按钮");
                    }
                  ),
                )
              ]
            ),

            SizedBox(
              height: 20.0,
            ),

            Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Expanded(
                  child: RaisedButton(
                    child: Text("自适应按钮"),
                    color: Colors.blue,
                    textColor: Colors.white,
                    onPressed: () {
                      print("普通按钮");
                    }
                  ),
                ),
              ]
            ),

            SizedBox(
              height: 20.0,
            ),

            Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Expanded(
                  child: Container(
                    height: 80.0,
                    width: 80.0,
                    child: RaisedButton(
                      child: Text("自适应按钮调节高度"),
                      color: Colors.blue,
                      textColor: Colors.white,
                      onPressed: () {
                        print("普通按钮");
                      }
                    ),
                  )
                ),
              ]
            ),

            SizedBox(
              height: 20.0,
            ),

            Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Expanded(
                  child: Container(
                    height: 80.0,
                    width: 80.0,
                    child: RaisedButton.icon(
                      icon: Icon(Icons.save),
                      label: Text("带图标的按钮"),
                    ),
                  )
                ),
              ]
            ),

            SizedBox(
              height: 20.0,
            ),

            Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                RaisedButton(
                  shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(10.0)
                  ),
                  child: Text("自适应按钮调节高度"),
                  color: Colors.blue,
                  textColor: Colors.white,
                  onPressed: () {
                    print("普通按钮");
                  }
                ),
                SizedBox(
                  width: 20.0,
                ),
                Container(
                  height: 80,
                  child: RaisedButton(
                    shape: CircleBorder(
                      // 如果不要边框去掉这一段即可
                      side: BorderSide(
                        color: Colors.black
                      )
                      // 如果不要边框去掉这一段即可
                    ),
                    child: Text("圆形按钮"),
                    color: Colors.blue,
                    textColor: Colors.white,
                    onPressed: () {
                      print("圆形按钮");
                    }
                  ),
                ),

                FlatButton(
                  onPressed: () {
                    print("按钮");
                  }, 
                  color: Colors.purple,
                  textColor: Colors.yellow,
                  child: Text("按钮"),
                ),

                OutlineButton(
                  child: Text("OutlineButton"),
                  onPressed: () {
                    print("按钮");
                  }, 
                  textColor: Colors.yellow,
                  borderSide: BorderSide(
                    color: Colors.red
                  )
                )
              ]
            ),

          ]
        ),
      ),
    );
  }
}